//
//  UserInfoViewController.m
//  OrderMeal
//
//  Created by qkong on 4/21/14.
//  Copyright (c) 2014 周浩. All rights reserved.
//

#import "UserInfoViewController.h"
#import "JSONURL.h"
#import "AFHTTPRequestOperationManager.h"

@interface UserInfoViewController ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *sexLabel;
@property (weak, nonatomic) IBOutlet UILabel *mailLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *buildingLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@end

@implementation UserInfoViewController
@synthesize retData = _retData;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.nameLabel.text = self.retData[@"lastName"];
    //性别 1男2女
    if ([self.retData[@"sex"] isEqualToNumber:@1]) {
        self.sexLabel.text = @"男";
    }else{
        self.sexLabel.text = @"女";
    }
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    self.mailLabel.text = [defaults objectForKey:@"username"];
    self.phoneLabel.text = self.retData[@"phone"];
    self.buildingLabel.text = self.retData[@"building"][@"name"];
    self.addressLabel.text = self.retData[@"address"];}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)pointsSelect:(id)sender {
    [self performSegueWithIdentifier:@"积分查询" sender:self];
}

- (IBAction)myOrder:(id)sender {
    [self performSegueWithIdentifier:@"我的订单" sender:self];
}

@end
